package bth.reconfs;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;

public class Travel extends ActionBarActivity{
	private ViewPager Tab;
	private TabPagerAdapter TabAdapter;
	private ActionBar actionBar;
	private String[][][] planningWeek = new String[MainActivity.NB_TABS][MainActivity.NB_MAX_LIST][2];

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		planningWeek[0][0][0] = "Monday 25th august";
		planningWeek[0][0][1] = "Doctoral Symposium, Workshops, Tutorials";
		planningWeek[0][1][0] = "Tuesday 26th august";
		planningWeek[0][1][1] = "Workshops, Tutorials";
		planningWeek[0][2][0] = "Wednesday 27th august";
		planningWeek[0][2][1] = "Invited Talk: Tony Wasserman, Research/Industry Tracks, Most Influential Paper and Posters Lightning Round";
		planningWeek[0][3][0] = "Thursday 28th august";
		planningWeek[0][3][1] = "Invited Talk: Annie I. Antón, Research/Industry Tracks, Industry Laboratory, Panels & Debates, Poster/Demo Sessions";
		planningWeek[0][4][0] = "Friday 29th august";
		planningWeek[0][4][1] = "Invited Talk: Anthony Finkelstein, Research/Industry Tracks, Panels & Debates, Workshop highlights, Mini-Tutorial";

		planningWeek[1][0][0] = "RE'14 - Student Volunteers";
		planningWeek[1][0][1] = "Mon Sep 01 2014";
		planningWeek[1][1][0] = "RE'14 - RE4SuSy Karlskrona Manifesto";
		planningWeek[1][1][1] = "Fri Aug 29 2014";
		planningWeek[1][2][0] = "RE'14 - Industry Collaboration Idea";
		planningWeek[1][2][1] = "Thu Aug 28 2014";
		planningWeek[1][3][0] = "RE'14 - Speed dating";
		planningWeek[1][3][1] = "Fri Aug 22 2014";
		planningWeek[1][4][0] = "RE'14 - Train ticket booking working again";
		planningWeek[1][4][1] = "Fri Aug 22 2014";
		planningWeek[1][5][0] = "RE'14 - Train ticket booking issues";
		planningWeek[1][5][1] = "Thu Aug 21 2014";
		planningWeek[1][6][0] = "RE'14 - Event calendar";
		planningWeek[1][6][1] = "Wed Aug 13 2014";
		createView();
	}

	@SuppressWarnings("deprecation")
	public void createView() {
		TabAdapter = new TabPagerAdapter(getSupportFragmentManager(), planningWeek);

		Tab = (ViewPager)findViewById(R.id.pager);
		Tab.setOnPageChangeListener(
				new ViewPager.SimpleOnPageChangeListener() {
					public void onPageSelected(int position) {

						actionBar = getSupportActionBar();
						actionBar.setSelectedNavigationItem(position);
					}
				});
		Tab.setAdapter(TabAdapter);

		actionBar = getSupportActionBar();
		//Enable Tabs on Action Bar
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
		ActionBar.TabListener tabListener = new ActionBar.TabListener(){

			public void onTabReselected(
					android.support.v7.app.ActionBar.Tab tab,
					android.support.v4.app.FragmentTransaction ft) {}

			public void onTabSelected(
					android.support.v7.app.ActionBar.Tab tab,
					android.support.v4.app.FragmentTransaction ft) {
				Tab.setCurrentItem(tab.getPosition());
			}

			public void onTabUnselected(
					android.support.v7.app.ActionBar.Tab tab,
					android.support.v4.app.FragmentTransaction ft) {}
		};
		//Add New Tabs
		actionBar.addTab(actionBar.newTab().setText("By plane").setTabListener(tabListener));
		actionBar.addTab(actionBar.newTab().setText("By road").setTabListener(tabListener));
		actionBar.addTab(actionBar.newTab().setText("In the city").setTabListener(tabListener));
	}
}